package com.leen.video.controller;


import com.leen.common.vo.ResultEnum;
import com.leen.common.vo.ResultVO;
import com.leen.video.entity.QiniuContent;
import com.leen.video.service.QiniuContentService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 七牛云文件存储 前端控制器
 * </p>
 *
 * @author yy
 * @since 2021-05-19
 */
@RestController
@RequestMapping("/video")
public class QiniuContentController {


    //增删改使用@PostMapping(value = "/job/add")  查找使用getmapping

    @Autowired
    private QiniuContentService qiniuContentService;

    @ApiOperation(value = "查询数据")
    @GetMapping(value = "/qiniucontent/data")
    public ResultVO<ResultVO> finAll( ){
        return ResultVO.success(this.qiniuContentService.findAll());
    }


    @ApiOperation(value = "新增数据")
    @PostMapping(value = "/qiniucontent/add")
    public ResultVO<String>add(@RequestBody QiniuContent qiniuContent){
        QiniuContent save = this.qiniuContentService.save(qiniuContent);
        return save!=null?ResultVO.success(ResultEnum.DB_SUCCESS):ResultVO.failed(ResultEnum.DB_FAILED);
    }

    @ApiOperation(value = "修改数据")
    @PostMapping(value = "/qiniucontent/update")
    public ResultVO<String>update(@RequestBody QiniuContent qiniuContent){
        QiniuContent save = this.qiniuContentService.save(qiniuContent);
        return save!=null?ResultVO.success(ResultEnum.DB_SUCCESS):ResultVO.failed(ResultEnum.DB_FAILED);
    }


}

